package com.pn.taikao.mapper;

import com.pn.taikao.entity.Answer;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 答题Mapper
 */
@Mapper
public interface AnswerMapper {
    /**
     * 插入答题记录
     */
    int insert(Answer answer);
    
    /**
     * 更新答题记录
     */
    int update(Answer answer);
    
    /**
     * 根据考试ID和题目ID查询答题记录
     */
    Answer selectByExamIdAndQuestionId(@Param("examId") Long examId, @Param("questionId") Long questionId);
    
    /**
     * 根据考试ID查询所有答题记录
     */
    List<Answer> selectByExamId(@Param("examId") Long examId);
    
    /**
     * 删除考试的所有答题记录
     */
    int deleteByExamId(@Param("examId") Long examId);
}


